﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SaiLing.Common;
using SaiLing.SingleSignOn.Application.Core.DataTransferObject.System;
using SaiLing.SingleSignOn.Application.Service.Interfaces.System;

namespace SaiLing.SingleSignOn.WebApi.Controllers
{
    [Authorize("Web")]
    [Route("api/[controller]/[action]")]
    public class AuthController : Controller
    {
        private IAccountService AccountService { get; set; }

        public AuthController(IAccountService accountService)
        {
            this.AccountService = accountService;
        }

        [HttpGet]
        public string Test()
        {
            return "MMP";
        }

        [HttpGet]
        public async Task<bool> Auth(string token)
        {
            var user = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme).Result;
            var auth = user.Principal.Claims.Where(x => x.Value == "token");
            return true;
        }
    }
}
